<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/StudentRevise.css">
</head>
<body>
<div class="container information-content">
    <div class="content">
        <div class="information-title">
            <span>当前位置>修改密码</span>
        </div>
        <form id="form1">
        <div class="revise-content clearfix ">
            <div class="list fr"><label>原密码</label> : <input type="password" value="" name="oldpwd"/></div>
            <div class="list fr"><label>新密码</label> : <input type="password" value="" name="newpwd1"/></div>
            <div class="list fr "><label>确认密码</label> : <input type="password" value="" name="newpwd2"/></div>
        </div>

        <div class="list1 "> <input  id="save" type="button" value="提交" "/></div>
        </form>
    </div>
</div>
<script src="js/jquery-1.9.1.min.js"></script>
<script>
    $('#save').on('click',function(){


        $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            dataType: "json",//预期服务器返回的数据类型
            url: "/admin/teacher/password" ,//url
            data: $('#form1').serialize(),
            success: function (result) {
               // console.log(result);//打印服务端返回的数据(调试用)
                if (result.code == 201) {
                    alert("请填写原密码");
                };
                if (result.code == 202) {
                    alert("请填写新密码");
                };
                if (result.code == 203) {
                    alert("请填写确认密码");
                };
                if (result.code == 200) {
                    alert("原密码错误");
                };
                if (result.code == 100){
                  alert("新密码不一致") ;
                };
                if(result.code == 300){
                    alert("修改成功");
                    location.reload();
                };

            },
            error : function() {
                alert("异常！");
            }
        });
    });

</script>
</body>
</html>